import { request } from '../../request/index'

const app = getApp()

Page({
  data: {
   user: {}
  },
  onShareAppMessage:function(options){},
  onShow: function(e) {
    let tuser = wx.getStorageSync('user')
    if (!tuser) {
      wx.navigateTo({url: '../login/login'})
      return
    }
    console.log(tuser)   
    request({
        url: '/user/' + tuser.id ,
        method: 'GET'
      }).then(res => {
        var t=this
        this.setData({
          user: tuser
        })
      }) 
  },

  my_collect() {
    wx.navigateTo({
      url: '../me/my_collect/my_collect',
    })
  },

  logout() {
    wx.removeStorageSync('user')
    wx.navigateTo({
      url: '../login/login',
    })
  },
  
  modify(){
    wx.navigateTo({
      url: '../me/message/message',
    })
  }


})


